package com.forever7776.life.core.service.impl.comment;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.forever7776.life.core.common.vo.UserCommentVO;
import com.forever7776.life.core.entity.comment.CommentBlog;
import com.forever7776.life.core.mapper.comment.CommentBlogMapper;
import com.forever7776.life.core.service.comment.ICommentBlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 博客评论表 服务实现类
 * </p>
 *
 * @author kz
 * @since 2018-04-09
 */
@Service
public class CommentBlogServiceImpl extends ServiceImpl<CommentBlogMapper, CommentBlog> implements ICommentBlogService {

    @Autowired
    private CommentBlogMapper commentBlogMapper;

    /**
     * 查询博客评论列表
     *
     * @param page
     * @param blogId
     * @param userId
     * @return
     */
    @Override
    public Page<UserCommentVO> selectBlogCommentsList(Page<UserCommentVO> page, Integer blogId, String userId) {
        List<UserCommentVO> list = commentBlogMapper.selectBlogCommentList(blogId, userId);
        page.setRecords(list);
        return page;
    }

    /**
     * 查询博客评论的用户ID
     *
     * @param blogId
     * @return
     */
    @Override
    public List<String> selectBlogCommentUserIds(Integer blogId) {
        return commentBlogMapper.selectBlogCommentUserIds(blogId);
    }
}
